using Pay.IService;
using System;
using System.Data.Entity;

namespace Pay.Service {
	public interface IUnitOfWork : IDisposable {
		DbContext Context { get; }
		int Commit(params string[] cacheTags);
		void ClearCache(params string[] cacheTags);

		/// <summary>
		/// 返回缓存
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		T GetCache<T>(string key);
		/// <summary>
		/// 删除缓存
		/// </summary>
		/// <param name="key"></param>
		/// <returns></returns>
		bool RomoveCache(string key);
		/// <summary>
		/// 设置缓存
		/// </summary>
		/// <param name="key"></param>
		/// <param name="value"></param>
		/// <param name="seconds"></param>
		void SetCache(string key, object value, int? seconds = null);
		void ErrorLog(Exception ex);
	}
}
